package main

import (
	"gxgeek.com/gxgeek/learngo/crawler_distributed/rpcsupport"
	"gxgeek.com/gxgeek/learngo/crawler_distributed/worker"
	"log"
	"fmt"
	"flag"
)



var port = flag.Int("port", 0,
	"the port for me to listen on")
//-port=9000
func main() {
	flag.Parse()
	//fetcher.SetVerboseLogging()
	if *port == 0 {
		fmt.Println("must specify a port")
		return
	}
	log.Fatal(rpcsupport.ServerRpc(
		fmt.Sprintf(":%d", *port),
		worker.CrawlService{}))
	//log.Fatal(rpcsupport.ServerRpc(fmt.Sprintf(":%s", config.TestWorkerPort),
	//	&worker.CrawlService{}))

}

//func serveRpc(host string) error {
//	return rpcsupport.ServerRpc(host,
//		&worker.CrawlService{})
//}

